/**
    ATClab - scriptable Air Traffic Control simulations.
    Copyright (C) 2010 openatclab@gmail.com

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
**/

#ifndef __ATC_WAYPOINTSPRITE_HDR__
#define __ATC_WAYPOINTSPRITE_HDR__


#include <q3canvas.h>
#include "canvas_types.h"
#include <string>


namespace atc{

	//
	// atc
	//
	class Canvas;


	//
	// atc::WayPointSprite
	//
	class WayPointSprite {

	public: 
		WayPointSprite( const std::string&, QPoint, atc::Canvas * );
		~WayPointSprite();

	public:
		bool hit(QPoint)const;

		double x()const{ return _point->x(); }
		double y()const{ return _point->y(); }

		void toggle();

	private:
		Q3CanvasEllipse *_point;
		Q3CanvasText    *_name;

		bool _visible;
	};


	//
	// atc::WPLocator
	//
	class WPLocator : public Q3CanvasEllipse {

	public:
		WPLocator( WayPointSprite *s, int w, int h, Q3Canvas *c  ) 
			  : Q3CanvasEllipse( w, h, c ), _waypoint( s ) {}
		~WPLocator() { hide(); }

	public: //virtual
		int rtti() const { return CanvasItem::RTTI_WPLOCATOR; }

	public:
		WayPointSprite* waypoint() { return _waypoint; }

	private:
		WayPointSprite *_waypoint;
	
	};


	//
	// atc::WPText
	//
	class WPText : public Q3CanvasText {

	public:
		WPText( const QString &s, QFont f, Q3Canvas *c ) 
			  : Q3CanvasText( s, f, c ) {} 
		~WPText() { hide(); }

	public: //virtual
		int rtti() const { return CanvasItem::RTTI_WPTEXT; }

	};


};

#endif
